home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
726-750
/
745
/
bbbbs
/
bbbbs55.lzh
/
rexxDoors
/
Grin_du_Jour.rexx
next >
Wrap
OS/2 REXX Batch file
|
1991-12-05
|
2KB
|
58 lines
/*
$VER: 1.1 Grin_du_Jour.rexx 29 June 1991 (29.6.91)
copyright 1991 Richard Lee Stockton
FREELY DISTRIBUTABLE
This will manage grin (cookie, fortune, etc.) files up to about 12 MEG
*/
FF='0C'x /* FormFeed */
CR='0D'x /* Carraige Return */
SIGNAL ON BREAK_C
SIGNAL ON BREAK_E
ARG name .
bbspath=GETCLIP('BBS_path')
filename=bbspath'rexxDoors/Data/Grins' /* Formfeed separated text */
size=WORD(STATEF(filename),2)
fragment=size/3000
x=OPEN(f,'RAM:DUMMY','W') /* write to a dummy file */
IF x=0 THEN EXIT(20);
CALL WRITELN(f,'dummy')
CALL CLOSE(f)
micros=WORD(STATEF('RAM:DUMMY'),7) /* 0 >= micros < 3000 */
location=fragment*micros
IF fragment>1000 THEN
location=location+fragment*RIGHT(TIME('S'),2)/100
ELSE IF fragment>100 THEN
location=location+fragment*RIGHT(TIME('S'),1)/10
location=TRUNC(location)
IF location>size THEN location=micros
x=OPEN(f,filename,'R')
IF x=0 THEN RETURN(10);
CALL SEEK(f,location,'B') /* point to the random place */
line=''
DO WHILE line~=FF & ~EOF(f) /* find the start (a formfeed) */
line=READLN(f)
END
count=0
line=''
IF ~EOF(f) THEN /* if EOF then must be right at end. missed! */
DO WHILE line~=FF & ~EOF(f) /* otherwise, show the page */
line=READLN(f)
IF ~EOF(f) & line~=FF THEN
DO
SAY line||CR
count=count+1
END
END
BREAK_C:
BREAK_E:
CALL CLOSE(f)
RETURN(count);
EXIT; /* a little redundant, so sue me! */